﻿<html>
<head>
<title>B哥自制 - 计算直角三角形斜边长度</title>
<meta http-equiv="content-type" contnet="text/html" charset="utf-8"/>
</head>
<body>
<center>
<h1>B哥 - 计算直角三角形斜边长度</h1>
<form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>"/>
直角边1:<input type="number" name="a"/>
<br/>直角边2:<input type="number" name="b"/><br/><br/>
<input type="submit" value="计算"/>
<input type="reset" value="重置"/>
</form>
</center>
<?php
if(empty($_GET['a'])){
	echo '<hr/>请输入内容!';
	exit;
}
if(empty($_GET['b'])){
	echo '<hr/>请输入内容!';
	exit;
}
$a = $_GET['a'];
$a = (float)$a;
if($a <= 0){
	echo '<hr/>不能为零或小于零!';
	exit;
}
$b = $_GET['b'];
$b = (float)$b;
if($b <= 0){
	echo '<hr/>不能为零或小于零!';
	exit;
}
echo '<hr/>';
echo '直角边①:<font color=blue>'.$a.'</font>';
echo '<br/><br/>直角边②:<font color=blue>'.$b.'</font>';
echo '<br/><br/>斜边长[结果]:<font color=red>'.hypot($a,$b).'</font>';
?>
</body>
</html>